<style>
    table.table-form-title{margin:20px auto 0;}
    table.table-form-title td{text-align: center;border-bottom:0 !important;}
    table.table{width:90%;margin:0 auto;}
    table.table-form-attach{margin-bottom:100px;}
</style>
<div style="margin:0 auto;">
    <table class="table-form-title table" style="margin-top:20px;">
        <tr>
            <td colspan="4" style="border-bottom: 0 !important;">
                <h2>${config.getKey("COMPANY_NAME")}</h2>
                <h2>${bpmTaskFrom.fromName}</h2>
                <input type="hidden" name="processInstanceId" value="${bpmForm.processInstanceId}" />
            </td>
        </tr>
    </table>
    <table class="table-form-head table table-hover table-bordered">
        <tr>
            <th>发起人</th>
            <td>
                <@f.tableselect name="initiator" value="" labelValue="${bpmForm.initiator}" boxTitle="用户信息" keyId="name" keyName="name"  checked=false
                tableInfo = "[{field:'username',title:'账号'},{field:'name',title:'姓名',query: true},{field:'compName',title:'归属公司'},
                {field:'deptName',title:'归属机构'},{field:'mobile',title:'手机号码'},
                {field:'status',title:'状态',dict:'sys_user_show_hide',query: true}]"  placeholder="请选择发起人" />
                <div id="c_tableselect2222" class="panel-collapse collapse"></div>
            </td>
            <th>发起日期</th>
            <td>
                <@f.input name="createTime" value="${bpmForm.createTime?string('yyyy-MM-dd')}" type="date" dataType="datetime" dataFormat="yyyy-MM-dd"
                placeholder="发起日期"  butClass="fa fa-calendar-plus-o" required=true />
            </td>
        </tr>
        <tr>
            <th>所属部门</th>
            <td>
                <@f.tableselect checked=false keyId="department" labelValue="${bpmForm.projectDept}" keyName="department" url="/bpm/project/list"
                name="projectDept" boxTitle="项目档案" tableInfo = "[{field:'fileNumber',title:'项目档案编号'},
                {field:'projectName',title:'项目名称'}, {field:'department',title:'项目所属部门'},
                {field:'contractFirst',title:'委托单位'},{field:'createTime',title:'创建时间'}]" placeholder="请选择所属部门" />
                <!--<@f.input name="projectDept" value="" placeholder="所属部门" required=true readonly=true />-->
            </td>
            <!--</tr>-->
            <!--<tr>-->
            <th>项目经理</th>
            <td>
                <@f.tableselect name="projectAdmin" value="" labelValue="" labelValue="${bpmForm.projectAdmin}" boxTitle="用户信息" url="bpm/manager/list" keyId="name" keyName="name" checked=false
                tableInfo = "[{field:'username',title:'账号'},{field:'name',title:'姓名',query: true},{field:'compName',title:'归属公司'},
                {field:'deptName',title:'归属机构'},{field:'mobile',title:'手机号码'},
                {field:'status',title:'状态',dict:'sys_user_show_hide',query: true}]"  placeholder="项目经理" />
                <!--<@f.input name="projectAdmin" value="" placeholder="项目经理" required=true readonly=true />-->
            </td>
        </tr>
        <tr>
            <th>委托供应商</th>
            <td colspan="3">
                <@f.input  name="clientSupplier" value="${bpmForm.clientSupplier}" placeholder="请输入委托供应商" required=true/>
            </td>
        </tr>
        <tr>
            <th>检测类别</th>
            <td colspan="3">
                <@f.input  name="checkType" value="${bpmForm.checkType}" placeholder="请输入检测类别" required=true/>
            </td>
        </tr>


        <tr>
            <th >处理意见</th>
            <td colspan="3">
                <@f.input  name="opinion" value="${bpmForm.opinion}"  placeholder="请输入处理意见" required=true/>
            </td>
        </tr>
        <tr>
            <th>备注</th>
            <td colspan="3">
                <@f.input  name="remark" value="${bpmForm.remark}" placeholder="请输入备注" required=true/>
            </td>
        </tr>


    </table>

</div>
<script type="text/javascript">
    function showFileDlg() {
        $("#file").click();
    }
    $("#file").change(function () {
        uploadBidedNotice();
    });
    function uploadBidedNotice() {
        var oFiles = document.getElementById("file").files;
        console.log(oFiles);
        var formdata = new FormData();
        formdata.append("file", oFiles[0]);
        opt.common.sendAjax({
            url: prefix + "/uploadFile",
            data: formdata,
            type: "POST",
            processData: false,
            contentType: false,
            success: function(result) {
                console.log(result);
                $("input[name=bidedNoticeName]").val(oFiles[0].name);
                $("input[name=bidedNoticeUrl]").val(baseURL + result.msg);
                $("a[name=bidedNoticeBox]").html(oFiles[0].name).attr("href",baseURL + result.msg);
                console.log("----------------------");
            }
        })
    }
    function tableCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        // if(id == "initiateDepartment"){
        //     console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
        //     console.log(nodes.table[0]);
        //     var data = nodes.table[0];
        //     console.log(data)
        //     console.log(data.department);
        //     console.log(data.ceoName);
        //     $("input[name=name]").val(data.name);
        //     $("input[name=projectName]").val(data.projectName);
        //     $("input[name=ceoName]").val(data.ceoName);
        //     $("input[name=projectAdmin]").val(data.ceoName);
        //     $("input[name=clientCompany]").val(data.contractFirst);
        //     $("input[name=projectDept]").val(data.department);
        // }
    }


    $("button[name=btn-insert]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length + 1;
        var tpl = $(target.children().get(0)).prop("outerHTML");
        tpl = tpl.replaceAll("1", index);
        target.append(tpl);
    });
    $("button[name=btn-del]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length - 1;
        if(index>0){
            target.children().get(index).remove();
        }
    });
    $("button[name=btn-del-all]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length - 1;
        for(var i=index; i>0; i--){
            target.children().get(i).remove();
        }
    });
</script>